Skip to content

fix: return to the key picker when a key prompt is cancelled - #103

Merged
ykisana merged 1 commit into
mainfrom
key-picker-fallback
Nov 14, 2026
Merged

ykisana merged 1 commit into
mainfrom
key-picker-fallback

Conversation

@ykisana

@ykisana ykisana commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #92.

Cancelling or failing a key prompt used to end the whole check, so with a Default Key set there was no way to use a different key. Now, when the picker has something else to offer (another key type, or Block without key), the prompt returns to Choose Key instead:

  • NFC: Cancel, a wrong tag or a timeout on Apple's popup.
  • QR Code / Barcode: Cancel in the scanner.
  • Location: closing the check. Location is now a screen inside the key sheet, like the QR scanner, instead of a second sheet, so closing it goes straight back to the picker. A verified location still unblocks.

This applies wherever the key check runs: Home, group cards, key-protected toggles, widgets and Shortcuts hand-offs. With only one key type and no bypass, nothing changes.

NFC default. Apple's popup comes up alone. Once it covers the screen, the picker slides in behind it as a short strip (no second dimming). When the popup closes, the strip grows to the full picker. A correct tag closes the strip behind Apple's "Key Verified" message. NFC picked from the picker keeps the full picker under Apple's popup, as before.

NFC timing. Measured on an iPhone 16e (iOS 26.5.2): iOS sends the app nothing while Apple's popup is closing. The first signal is the app becoming active, roughly 0.5–1 s after the popup is gone, and the session-ended callback comes about 0.5 s after that. NFCService ends the scan when the app becomes active instead of waiting for the callback. A wrong tag also waits for Apple's error message to close, so the picker doesn't grow behind it.

Stale results. Scans in the flow are tracked by their own ID, and NFCService ignores callbacks and tag reads from a session that is no longer current, so a late result can't end or pass the scan that replaced it.

Testing

  • KeyCheckFlowTests cover NFC cancel and wrong-tag retry, the minimized picker (shown only when there is another option, closed on success, full height for NFC chosen from the picker), QR Cancel (including the late-result race), Location shown in the key sheet and closing it, and the block flow.
  • All unit tests and BlockingUITests pass on the simulator.
  • The strip-then-grow sheet motion was checked in the simulator with a temporary stand-in for Apple's popup, which the simulator can't show.
  • On device: NFC timing was measured with a temporary recorder (not included). The latest change, which waits for Apple's popup before the strip appears, has not been run on a phone yet.

Cancelling or failing a key prompt ended the whole key check, so with a
Default Key set there was no way to use another key (#92). When the
picker has something else to offer, Cancel, a wrong NFC tag or closing
the location check now returns to Choose Key.

- Location is a screen inside the key sheet, like the QR scanner, so
  closing it goes straight back to the picker.
- With an NFC default, Apple's popup comes up alone. Once it covers the
  screen, the picker slides in behind it as a short strip, then grows
  to full height when the popup closes. A wrong tag waits for Apple's
  error message to close first.
- iOS sends nothing until the app becomes active after Apple's popup
  closes, so NFCService ends the scan then instead of waiting for the
  later delegate callback.
- Scans are tracked by ID and NFC callbacks by session, so a late
  result from an old scan can't end or pass the current one.

Fixes #92
@ykisana
ykisana force-pushed the key-picker-fallback branch from db836d2 to 4c3a633 Compare November 14, 2026 04:56
@ykisana
ykisana merged commit 36ce59c into main Nov 14, 2026
2 checks passed
@ykisana
ykisana deleted the key-picker-fallback branch November 14, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to use backup key if default key is turned on

1 participant